package com.njwb.day13.jingtai;

import java.lang.reflect.Proxy;

public class Main {
    public static void main(String[] args) {
        RealService real = new RealService();
/*        Service proxy = (Service) Proxy.newProxyInstance(
                real.getClass().getClassLoader(),
                real.getClass().getInterfaces(),
                new MyInvocationHandler(real)
        );
        proxy.dosomething(); // 执行代理方法*/
        Service p=(Service) Proxy.newProxyInstance(
                real.getClass().getClassLoader(),
                real.getClass().getInterfaces(),
                new MyInvocationHandler(real)
        );
        p.dosomething();
    }
}

